package com.dg11185.nearshop.net.request;

import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.HttpCacheRequest;
import com.dg11185.nearshop.net.response.GetMerchantInfoResponse;
/**
 * 获取商家详情
 * @author：Daibo    
 * @time：2014-5-23 上午10:12:21
 */
public class GetMerchantInfoRequest extends HttpCacheRequest<GetMerchantInfoResponse>{

    public GetMerchantInfoRequest(String merchantId) {
        super(Constants.ADDRESS, Constants.getMerchantInfo);
        addParam("merchantId", merchantId);
        addParam("chshToken", Constants.TOKEN);
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
    }

    public GetMerchantInfoRequest add(String key, String value){
        addParam(key, value);
        return this;
    }
    
    public GetMerchantInfoRequest encryption(){
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }
    
    @Override
    protected GetMerchantInfoResponse parseJson(String response) throws Exception {
        GetMerchantInfoResponse r = new GetMerchantInfoResponse();
        r.parseJson(response);
        return r;
    }

}
